#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    string path;
    vector<string> ret;
    int a[12];
    vector<string> letterCasePermutation(string s) {
        for (int i = 0; i < s.size(); ++i) {
            a[i] = 1;
        }
        dfs(s, 0);
        return ret;
    }
    void dfs(string& s, int pos) {
        if (pos == s.size()) {
            ret.push_back(path);
            return;
        }
        int i = pos;
        path += s[i];
        dfs(s, i + 1);

        path.pop_back();

        if (isalpha(s[i])) {

            path += isupper(s[i]) ? tolower(s[i]) : toupper(s[i]);

            dfs(s, i + 1);
            path.pop_back();
        }
    }
};